<?php
   
    /* 顶部页面展示
     *可展示用户是否登录
     *搜索功能，用户之间通讯的信息提示功能  暂未实现
     *  */
    require_once '../inc/config.php';/* 得到session_start */
    require_once '../inc/section.php';
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="../css/header.css">
	<script src="../script/header.js"></script>
</head>
<body>
	<div class="header">
	    <!-- 网站logo -->
		<img src="../image/header/logoHeader.png" class="headerlogo" title="Reading In Mind"/>
		<!-- 搜索栏 -->
		<div class="search">
		  <form action="search.php"  method="post" name="searchForm" id="searchForm"  onsubmit="return checksearchForm()" target="_blank">
				<input type="text"  class="fuzzy" placeholder="搜索或跳转至..." name="searchNew" />
				<button class="fuzzyBtn" type="submit"></button>
		  </form>
		</div>
		<!-- 菜单，信息，状态，通知等等 -->
		<div class="menus">
		  	<div class="center">
		  	<!-- 下拉菜单 -->
			<div class="menu">
				<ul id="menu" onMouseOver="change('menudown','block')" onMouseOut="change('menudown','none')">
					<li>
						<img src="../image/header/meun.png" />
					</li>
					<li>
						<ul id="menudown">		
							<a href="index.php"><li>首页</li></a>
							<a href="section.php?sectionId=1 &currentPage=1"><li>分类页</li></a>
							<a href="javascript:history.back(-1)"><li>返回上一页</li></a>
							
						</ul>
					</li>
				</ul>
			</div>		  	
		  	<!-- /* 判断当前是否有新消息 */ -->
		  	<?php         
		  	$notice="";
		  	if (isset($_SESSION['CURRENT_USER']))
		  	{     
		  	    $current_user=$_SESSION['CURRENT_USER'];
		  	    $uId=$current_user["uId"];
                       $notice.=<<<NOtice
		  	           <a href="#" ><img src="../image/header/notice.png" title="暂无新的消息" class="notice" /></a>
NOtice;
                   }
                   else 
                   {
                       $notice.=<<<NOtice
		  	           <a href="#" ><img src="../image/header/notice.png" title="暂无新的消息" class="notice" /></a>
NOtice;
                   }
                       echo $notice;
		  	?>
		  	<!-- 个人信息 ，判断是否登录，显示部分信息-->
		  	<?php 
		  	$curState="";
		  	if (isset($_SESSION['CURRENT_USER']))
		  	{
                    $current_user=$_SESSION['CURRENT_USER'];
                    $user_name=$current_user["uName"];
                    
                    $curState.=<<<curState
            <div class="state">
		  	   <ul id="state" onMouseOver="change('statedown','block')" onMouseOut="change('statedown','none')">
					<li>
						<img src="../image/header/user.png">
					</li>
					<li>
						<ul id="statedown">
							     <li id="stateName">登入为 $user_name</li>
							     <a href="perDocument.php"><li>个人资料</li></a>
							     <a href="seeSelf.php?uId=$uId"><li>您的主页</li></a>
                                 <a href="exchange.php?uId=$uId"><li>您的金币</li></a>
							     <a href="../admin/doLogOut.php" onclick="return confirm('确定退出当前账号吗')"><li>登出</li></a>
						</ul>
					</li>
				</ul>
		  		
		  		
		  	</div>  
curState;
                }
                else 
                {
                    $curState.=<<<curState
                    		  	<div class="state">
		  	<ul id="state" onMouseOver="change('statedown','block')" onMouseOut="change('statedown','none')">
					<li>
						<img src="../image/header/user.png">
					</li>
					<li>
						<ul id="statedown">
                            <a href="login.php"><li>登录</li></a>
                            <a href="register.php"><li>注册</li></a>
                            <a href="#"><li>帮助</li></a>
                            <a href="#"><li>了解我们</li></a>
						</ul>
					</li>
				</ul>
		  		
		  		
		  	</div>
curState;
                }
                    echo $curState;
		  	?>	
		  	</div><!-- center结束 -->
		</div><!-- menus结束 -->
	</div><!-- header结束 -->
</body>
</html>
